// 小轮播图
(function($){
    $.fn.slider = function(option){
       var defaults = {
          
           event:'mouseenter'

       }
        var settings = $.extend(defaults,option)
        var $this = this
        var lis = $this.find('.care-list').children();
        var pages = $this.find('.page').children();
        var index = 0;
        // 下一张
         function next(){
            index = index == lis.length - 1 ? lis.length - 1 : index + 1
            show()
         }  
        //  上一张
        function prev(){
            index = index == 0 ? 0 : index -1
            show()
        }
        function show(){
           $this.find('.care-list').stop().animate({'margin-left':-296*index},1000) 
           pages.eq(index).addClass('pager-active').siblings().removeClass('pager-active')
        }
        $this.find('.ture-prev').on(settings.event,function(){
            prev()
        })
        $this.find('.ture-next').on(settings.event,function(){
            next()
        })
        pages.on(settings.event,function(){
            index = $(this).index()
            show()
        })
       


    }

})(jQuery);

//图片来回切换
(function($){
    $.fn.hzhsilder = function(options){
        var defaults = {
            event:'mouseover'
        }
        var setting = $.extend(defaults,options)
        var $box =this
       
        var lis = $box.find('.toto').children();
        var hades = $box.find('.hade');
         var daxiao = 0;
        function show1(){
            lis.eq(daxiao).addClass('remen').siblings().removeClass('remen')
            hades.eq(daxiao).addClass('xianshi').siblings().removeClass('xianshi')
        }
        lis.on(setting.event,function(){
            daxiao = $(this).index();
            show1()
        })

    }

})(jQuery);

